package com.work.xxzl.mvp.presenter;

import com.work.xxzl.bean.CommonBean;
import com.work.xxzl.mvp.base.BaseMVPPresenter;
import com.work.xxzl.mvp.callback.MvpCallback;
import com.work.xxzl.mvp.contract.PlayVideoContract;
import com.work.xxzl.mvp.model.PlayVideoModel;

/**
 * author: Wangzhan
 * date :2018/9/19 0019 09:49
 * version:2.0.0
 * description:上传视频中介
 */

public class PlayVideoPresenter extends BaseMVPPresenter<PlayVideoContract.View> implements PlayVideoContract.Presenter {
    private PlayVideoContract.View view;
    private PlayVideoContract.Model model;

    public PlayVideoPresenter(PlayVideoContract.View view) {
        this.view = view;
        model = new PlayVideoModel();
    }

    @Override
    public void UploadVideo(String filepath) {
        view.showLoading();
        model.UploadVideo(filepath, new MvpCallback<CommonBean>() {
            @Override
            public void onSuccess(CommonBean data) {
                view.onSuccess(0,data.getMessage());
            }

            @Override
            public void onFailure(int errorcode, String msg) {
                view.onfailed(errorcode,msg);
            }


            @Override
            public void onComplete() {
                view.hideLoading();
            }
        });
    }
}
